/*
 * Copyright (c) 2025 Li Auto Inc. and its affiliates
 * Licensed under the Apache License, Version 2.0(the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Description: memmap internal implement header
 * AutoGenerate Code, DO NOT EDIT!!!
 * {{get_generation_time()}}
 * {{get_project_name()}}
 * {{get_vcos_version()}}
 */

#include <nuttx/compiler.h>

{%- set INNER_MODULE = 'OS' %}
{%- set memmap_int_cfg = get_memmap_internal_cfg() %}
{%- for map_key, map_val in memmap_int_cfg.items() %}
#if defined({{INNER_MODULE}}_STOP_SEC_{{map_key.upper()}})
#undef {{INNER_MODULE}}_STOP_SEC_{{map_key.upper()}}
#define _MEMMAP_SECTION_STOP {{loop.index}}
#undef {{INNER_MODULE}}_{{map_key.upper()}}
#elif defined({{INNER_MODULE}}_START_SEC_{{map_key.upper()}})
#undef {{INNER_MODULE}}_START_SEC_{{map_key.upper()}}
#define _MEMMAP_SECTION_START {{loop.index}}
{%- if 'text' in map_val.lower() %}
#define {{INNER_MODULE}}_{{map_key.upper()}} locate_code("{{map_val.lower()}}")
{%- else %}
#define {{INNER_MODULE}}_{{map_key.upper()}} locate_data("{{map_val.lower()}}")
{%- endif %}
#endif
{% endfor %}

